import java.util.Random;
import java.util.Scanner;

public class HoneWork {
    public static void main(String[] args) {
        int n = 24;
        int k = 18;
        int z = n % k;//6
        while(z != 0) {
            n = k;
            k = z;
            z = n % k;
        }
        System.out.println(k);
    }
    /*
    * @Project:Number guessing game
    * @Author:LLONG
    * @Version:1.0
    * */
    public static void game(String[] args) {
        Random random = new Random();
        int number = random.nextInt(101);
        //System.out.println(number);//生成随机数
        Scanner input = new Scanner(System.in);
        while(true){
            System.out.print("请猜数字：");
            int num = input.nextInt();//玩家输入要猜的数字
            if (number == num) {
                System.out.println("猜对了");
                break;
            }
            else if (number > num ) {
                System.out.println("猜小了");
            }
            else {
                System.out.println("猜大了");
            }
        }
    }
    public static void Number(String[] args) {
        for (int i = 1; i <= 999999999 ; i++) {
            int count = 0;//计数器
            int sum = 0;//统计总数
            int num = i;
            while(num != 0) {
                num /= 10;
                count++;
            }
            //此时count是几就是几位数
            num = i;
            while (num != 0) {
                //求次幂
                sum += Math.pow(num % 10, count);
                num /= 10;
            }
            //sum就是累加的次幂后的和

            //判断是不是水仙花数
            if (sum == i) {
                System.out.println(i);
            }
        }
    }
    public static void Binary(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个数字");
        int num = input.nextInt();//输入
        for (int i = 31; i >= 1 ; i -= 2) {
            System.out.print(((num >> i) & 1 )+ " ");//偶数
        }
        System.out.println();
        for (int i = 30; i >= 0 ; i -= 2) {
            System.out.print(((num >> i) & 1 )+ " ");//奇数
        }
    }
    public static void EndValue(String[] args) {
        double sum = 0;//统计值
        for (int i = 1; i <= 100 ; i++) {
            if (i % 2 == 0) {
                //偶数要减
                sum -= 1.0 / i;
            }
            else {
                //奇数要加
                sum += 1.0 / i;
            }
        }
        System.out.println(sum);
    }
    public static void CountOfOne(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Please input one number:");
        while(input.hasNextInt()) {
            int num = input.nextInt();//输入
            int count = 0;
            for (int i = 1; i <= 32; i++) {
                if (((num & 1) == 1)) {
                    count++;
                }
                num >>= 1;
            }
            System.out.println("1的个数：" + count);
        }
    }
    public static void XShape(String[] args) {
        Scanner input = new Scanner(System.in);
        while(input.hasNextInt()) {
            int num = input.nextInt();
            for (int i = 0; i < num; i++) {
                for (int j = 0; j < num; j++) {
                    if (i == j || i + j == num - 1) {
                        System.out.print("*");
                    }
                    else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }

    public static void LoginSimulation(String[] args) {
        int num = 3;//输入的次数
        String Pass = "123456";
        Scanner input = new Scanner(System.in);
        while (num > 0) {
            System.out.println("请输入密码：");
            String word = input.nextLine();//输入密码
            if (word.equals("123456")) {
                System.out.println("密码正确");
                break;
            }
            else {
                System.out.println("密码错误，重新输入：");
                num--;
                if (num < 1) {
                    System.out.println("3次均输入错误，退出程序");
                    break;
                }
            }
        }

    }

    public static void main6(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("输入n：");
        int n = scan.nextInt();
        for (int i = 1; i <= n ; i++) {
            for (int j = 1; j <= i ; j++) {
                System.out.printf("%2d * %2d = %2d", j, i, i * j);
            }
            System.out.println();//换行
        }
    }

    public static void main5(String[] args) {
        int num = 1234;
        int n = 0;
        while(num > 0) {
            n = num % 10;//将个位数剥离
            //舍去个位
            int value = num /= 10;
            //输出
            System.out.print(n);
        }
    }

    public static void main4(String[] args) {
        int count = 0;//记录个数
        for (int i = 1; i <= 100 ; i++) {
            if (i / 10 == 9) {
                count++;//十位的9
            }
            if (i % 10 == 9) {
                count++;//个位的9
            }
        }
        System.out.println(count);
    }

    public static void main3(String[] args) {
        int count = 0;//记录闰年个数
        for (int i = 1000; i <= 2000; i++) {
            if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
                System.out.println(i);//输出闰年
                count++;
            }
        }
        System.out.println(count);//输出个数
    }

    public static void main2(String[] args) {
        for (int i = 0; i <= 100; i++) {
            if (i % 2 == 0) {
                //不是素数
            } else {
                System.out.print(i);
            }
        }
    }

    public static void main1(String[] args) {
        int num = 123;
        for (int i = 2; i < 123; i++) {
            if (num % 2 == 0) {
                //整除说明不是素数
                System.out.println("num是素数");
                break;
            }
        }
        System.out.println("num是素数");
    }
}
